<template>
	<view class="shop" :style="'flex-wrap:'+wrap+';'">
		<view class="shop-item" v-for="(item,index) in dataList" :key="index" :style="'width:'+itemW+';' " @tap='godetail(item.id)'>
			<image class="shop-img" :src="item.imgUrl" mode="" :style="'height:'+bigH+';'"></image>
			<view class="shop-text" :style="'font-size:'+nameSize+';'">
				<text class="shop-name">
					{{item.name}}
				</text>
				<view class="price">
					<text class="pprice">{{item.pprice}}</text>
					<text class="oprice">{{item.oprice}}</text>
				</view>
					<view><text class="discount">{{item.discount}}</text></view>
			</view>
		</view>
	</view>

</template>

<script>
	export default{
		props:{
			dataList:Array,
			itemW:{
				type:String,
				default:"375rpx"
			},
			bigH:{
				type:String,
				default:"375rpx"
			},
			wrap:{
				type:String,
				default:"wrap"
			},
			nameSize:{
				type:String,
				default:"32rpx"
			}
		},
		methods:{
			godetail(id){
				uni.navigateTo({
					url:'/pages/details/details?id='+id+''
				})
			}
		}
	}
	
</script>

<style scoped>
	.shop {
		display: flex;
	}

	.shop-item {
		padding-bottom: 20rpx;
	}

	.shop-img {
		width: 100%;
		height: 375rpx;
	}
	
	.shop-name{
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		color:#333333;
		word-break: break-all;
		padding:5rpx 20rpx
	}
	
	.oprice{
		text-decoration: line-through;
		color:#999999
	}
	
	.shop-text{
		text-align: center;
	}
		
	.discount{
		border-radius: 4rpx;
		border:1px solid #ff3333;
		padding:2rpx 10rpx;
		font-size: 30rpx;
		color:#ff3333;
	}
</style>
